package lyo.levelup.swing.hometask1;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import javax.swing.JPanel;

public class TextPanel extends JPanel
{

    private long coordX, coordY;

    public TextPanel(double a, double b)
    {
        coordX = (long)a;
        coordY = (long)b;
        setMinimumSize(new Dimension(220, 100));
        setMaximumSize(new Dimension(220, 100));
        setPreferredSize(new Dimension(220, 100));
    }
    
    public void paintComponent(Graphics grphcs)
    {
        super.paintComponent(grphcs);
        Graphics graph = (Graphics) grphcs;
        Font font = new Font(Font.MONOSPACED, Font.BOLD, 18);
        graph.setFont(font);
        graph.drawString("X:" + coordX, 20, 20);
        graph.drawString("Y:" + coordY, 20, 40);
    }
}
